<template>
  <div class="home">
    <div class="main">
      <div class="search">
        <img
          class="search-icon"
          src="https://kpan.oss-cn-hangzhou.aliyuncs.com/mini_program/search.png"
          alt=""
        />
        <input type="text" placeholder="53度飞天茅台" />
      </div>
      <!-- 轮播图 -->
      <div class="swiper-body">

        <wx-swiper
          class="swiper"
          indicatorColor="#999"
          indicatorActiveColor="#333"
          current="current"
          :duration="swiper.duration"
          :interval="swiper.interval"
          :circular="swiper.isCircular"
          :autoplay="swiper.isAutoplay"
          :indicatorDots="swiper.hasIndicatorDots"
        >
          <wx-swiper-item v-for="(item, idx) in swiper.imgUrls" :key="idx">
            <img :src="item" class="slide-image" />
          </wx-swiper-item>
        </wx-swiper>
        <!-- <img
          src="http://www.seresgroup.cn/images/maotai/home/banner.png"
          alt=""
        />  -->
      </div>
      <checkbox value="cb" checked="true"/>选中
      <!-- 标题 -->
      <div class="index-service">
        <div class="index-service-h3">
          买酒就送30年免费存储服务 >
        </div>
        <div class="index-service-p">
          专业酒窖 | 一酒一芯 | 提货包邮
        </div>
      </div>
      <!-- 圖1 -->
      <div class="pic">
        <img :src="img1" alt="" />
      </div>
      <!-- 保险 -->
      <div class="bx">
        <div>〓中国人保ⅹ酒票提供全方位保障</div>
        <div class="bx-p">正品保真 | 诚信保牌 | 专业酒窖 | 四大服务</div>
      </div>
      <!-- 预售 -->
      <div class="yushou">
        <div class="yushou-titel">
          <img
            src="http://www.seresgroup.cn/images/maotai/home/yszq.png"
            alt=""
          />
          <span>更多名酒预售</span>
        </div>
        <div class="card-body">
          <div
            class="card-body-item"
            v-for="(item, index) in cardDatas"
            :key="index"
          >
            <div class="task-submit">
              <div class="task-submit-picture" v-if="item">
                <div
                  class="task-submit-picture-item"
                  @click="onSelImg('img', index)"
                >
                  <img :src="item.resourceUrl" alt="" />
                </div>
                <div class="task-submit-name-item">
                  <h1>{{ item.name }}</h1>
                </div>
                <!-- 底部 -->
                <div class="task-submit-bottom">
                  <div class="task-submit-bottom-look">
                    {{ item.lookNum }}
                  </div>
                  <div class="task-submit-bottom-good">
                    {{ item.dzNum }}
                    <div class="hot">
                      {{ item.hotNum }}
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import Footer from "@/components/Footer.vue";
import global from "@/utils/global";

@Component({
  components: {
    Footer
  }
})
export default class HomeIndex extends Vue {
  private img1 = global["homePic1"];
  private swiper = {
    interval: 5000,
    isCircular: true,
    isAutoplay: true,
    hasIndicatorDots: true,
    imgUrls: [
      "http://www.seresgroup.cn/images/maotai/home/banner.png",
      "https://img11.360buyimg.com/babel/s700x360_jfs/t1/4776/39/2280/143162/5b9642a5E83bcda10/d93064343eb12276.jpg!q90!cc_350x180",
      "https://img14.360buyimg.com/babel/s700x360_jfs/t1/4099/12/2578/101668/5b971b4bE65ae279d/89dd1764797acfd9.jpg!q90!cc_350x180"
    ]
  };
  private current = 0;

  private cardDatas = global["testList"];
  jump(url: string) {
    window.open(url);
  }
}
</script>

<style lang="scss">
.main {
  margin-top: 10px;
  .search {
    margin: 0 20px;
    border-radius: 3px;
    height: 45px;
    background: white;
    box-shadow: 0px 0px 4px 4px rgb(230, 229, 229);
    display: flex;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
    .arrow-down {
      width: 8px;
      height: 8px;
      margin-left: 5px;
    }
    .search-icon {
      width: 15px;
      height: 15px;
      vertical-align: text-top;
    }
    .line {
      vertical-align: text-top;
      margin: 0 10px;
      color: rgb(194, 194, 194);
    }
    input {
      outline: none;
      border: none;
      color: rgb(194, 194, 194);
    }
  }
  .swiper-body {
    padding: 10px;
    height: 130px;
    img {
      width: 100%;
    }
  }
  .swiper {
    border-radius: 10px;
    overflow: hidden;
    width:100%;
    height: 300px;
  }
  .index-service {
    margin: 10px;
    &-h3 {
      font-size: 20px;
      color: #000;
      font-weight: bold;
    }
    &-p {
      font-size: 14px;
      color: #aaa;
      margin-top: 10px;
    }
  }
  .bx {
    text-align: center;
    margin: 20px;
    background: rgba(202, 200, 200, 0.2);
    padding: 5px;
    border-radius: 8px;
    color: #000;
    font-size: 18px;
    &-p {
      font-size: 14px;
      color: #aaa;
    }
  }
  .pic {
    padding: 10px;
    height: 180px;
    img {
      width: 100%;
    }
  }
  // 预售
  .yushou {
    background: #fbeee6;
    border-radius: 10px;
    padding: 0 10px;
    margin: 2px;
    &-titel {
      padding: 10px;
      color: #999999;
      font-size: 12px;
      img {
        width: 80px;
        height: 25px;
      }
      span {
        float: right;
      }
    }
    .card-body {
      display: flex;
      overflow: hidden;
      &-item {
        margin-right: 10px;
        &:nth-child(5n) {
          margin: 0;
          margin-top: 20px;
        }
      }
    }
    .task-submit {
      .task-submit-picture {
        display: flex;
        flex-wrap: wrap;
        background: #fff;
        overflow: hidden;
        width: 90px;
        &-item {
          background-repeat: no-repeat;
          background-position: center;
          background-size: cover;
          height: 90px;
          overflow: hidden;
          img {
            width: 100%;
          }
        }
        .task-submit-name-item {
          text-align: left;
          padding: 6px;
          h1 {
            color: #333333;
            margin: 0;
            font-size: 13px;
          }
        }
        .task-submit-bottom {
          font-size: 12px;
          padding-left: 5px;
          &-look {
            color: #ff5555;
          }
          &-good {
            display: flex;
            color: #155288;
            .hot {
              margin: 0 5px;
              padding: 0 5px;
              background: #155288;
              border-radius: 4px;
              text-align: center;
              color: #fff;
            }
          }
        }
      }
    }
  }
}
</style>
